package com.ruoyi.system.mapper;

import java.util.List;
import com.ruoyi.system.domain.ByOrderPayLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 支付日志Mapper接口
 *
 * @author ruoyi
 * @date 2023-06-14
 */
@Mapper
public interface ByOrderPayLogMapper {

    @Select("SELECT * FROM `by_order_pay_log` where order_sn = #{orderSn} ORDER BY addtime desc")
    List<ByOrderPayLog> getOrderPayLogByOrderSn(@Param("orderSn") String orderSn);

    @Select("SELECT * FROM `by_order_pay_log` where `status` = '1' and order_sn = #{orderSn} ORDER BY addtime desc")
    List<ByOrderPayLog> getOrderPayLogByStatusAndOrderSn(@Param("orderSn") String orderSn);


    @Update("UPDATE by_order_pay_log set status='1' where pay_id = #{payid} and order_sn = #{orderSn}")
    int updatePayIdbyOderSn(@Param("orderSn") String orderSn,@Param("payid") String payid);
    /**
     * 查询支付日志
     *
     * @param id 支付日志主键
     * @return 支付日志
     */
    public ByOrderPayLog selectByOrderPayLogById(Long id);

    /**
     * 查询支付日志列表
     *
     * @param byOrderPayLog 支付日志
     * @return 支付日志集合
     */
    public List<ByOrderPayLog> selectByOrderPayLogList(ByOrderPayLog byOrderPayLog);

    /**
     * 新增支付日志
     *
     * @param byOrderPayLog 支付日志
     * @return 结果
     */
    public int insertByOrderPayLog(ByOrderPayLog byOrderPayLog);

    /**
     * 修改支付日志
     *
     * @param byOrderPayLog 支付日志
     * @return 结果
     */
    public int updateByOrderPayLog(ByOrderPayLog byOrderPayLog);

    /**
     * 删除支付日志
     *
     * @param id 支付日志主键
     * @return 结果
     */
    public int deleteByOrderPayLogById(Long id);

    /**
     * 批量删除支付日志
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteByOrderPayLogByIds(Long[] ids);
}
